from GraphAbstract.GraphSceneAbstract.GraphSceneController import GraphSceneController;
from GraphSettings.GraphGuiSettings.GraphLayout.LayoutSettings import LayoutSettings;
from GraphSettings.GraphGuiSettings.SettingsPane.GraphSettingsPane import GraphSettingsPane;
from GraphSettings.GraphGuiSettings.StateTraceEvents.TraceEventsPane import TraceEventsPane;
from InterfaceCmds.InterfaceNetwork import InterfaceNetwork;
from InterfaceCmds.InterfaceAPI import InterfaceAPI; #@UnusedImport
from MovieScene.MovieScene_Pane import MovieScene_Pane;
from GraphSettings.GraphCmds.ToolbarCmds import ToolbarCmds;
from GraphSettings.GraphCmds.ActionCmds import ActionCmds;
from DataContainer.DataController import DataController;
from GraphSettings.GraphCmds.MenuCmds import MenuCmds;
from CustomGuiItems.MyDockWidget import MyDockWidget;
from ViewCanvas import ViewCanvas;
from PyQt4 import QtCore, QtGui;
import sys;

class Ui_MainWindow(QtCore.QObject):
    def setupUi(self, MainWindow):
        self.mainWin = MainWindow;
        self.mainWin.setWindowTitle("Visual B3");
        self.mainWin.resize(1224, 768); #(1024, 768);
        
        self.centralwidget = QtGui.QWidget(self.mainWin);
        self.mainWin.setCentralWidget(self.centralwidget);
        self.statusbar = QtGui.QStatusBar(self.mainWin);
        self.mainWin.setStatusBar(self.statusbar);
        
        #Create Undo/Redo Actions & GraphView/GraphScene
        self.undoStack = QtGui.QUndoStack(self);
        self.graphScene = GraphSceneController(self);
        self.graphicsView = ViewCanvas(self, self.graphScene);
        self.graphicsView.setRenderHint(QtGui.QPainter.Antialiasing, True);
        self.graphicsView.setRenderHint(QtGui.QPainter.HighQualityAntialiasing, True);        
        self.graphicsView.createScene();
        self.myDockWidgetGraph = MyDockWidget("Graph B3", self, True);
        self.myDockWidgetGraph.setWidget(self.graphicsView);
        self.mainWin.setCentralWidget(self.myDockWidgetGraph);
        self.stTraceEvents = None;
        self.dataContainer = DataController(self, self.graphScene);
        self.layoutSettings = LayoutSettings(self);
        self.graphSettings = GraphSettingsPane(self);
        self.stTraceEvents = TraceEventsPane(self);
        self.intNetwork = InterfaceNetwork(self);
        self.movieScene_Pane = MovieScene_Pane(self);
        
        #Action Cmds
        self.actionCmds = ActionCmds(self, self.graphScene, self.graphicsView);
        self.mainMenu = MenuCmds(self, self.actionCmds);
        self.mainToolBar = ToolbarCmds(self, self.actionCmds);
        self.actionCmds.activateToolBarCmd(self.mainToolBar);
        self.graphicsView.createContextMenu(self.actionCmds);
        
        #Hide some Panes
        self.intNetwork.myDockWidget.setVisible(False);
        self.stTraceEvents.myDockWidget.setVisible(False);
        self.graphSettings.myDockWidget.setVisible(False);
        self.layoutSettings.myDockWidget.setVisible(False);
        self.movieScene_Pane.myDockWidget.setVisible(True);
        
        #Load Default Data
        #self.dataContainer.loadData("C:/Users/Alfredo/workspace/VisualMDP/src/StoredData/defaultDataMaze80_FatalsPILP.dat");        
        #Load Default Settings
        #self.dataContainer.loadSettings("C:/Users/Owner/workspace/VisualMDP/src/StoredData/defaultSettingsMaze80_FatalsPILP.opc");
        
#        self.interfaceApi = InterfaceAPI(self);
#        self.interfaceApi.setStateType(2,"Current");
        
#        self.dataContainer.updateDataFromGraph(0,0);
#        self.dataContainer.updateGrid(0,0);

if __name__ == "__main__":
    app = QtGui.QApplication(sys.argv);
    MainWindow = QtGui.QMainWindow();
    ui = Ui_MainWindow();
    ui.setupUi(MainWindow);
    MainWindow.show();
    sys.exit(app.exec_());
    
